[Processing/Java]Visibility/Layering Issue

Posted by nnash on Stack Overflow See other posts from Stack Overflow or by nnash
Published on 2011-01-15T21:45:02Z Indexed on 2011/01/15 22:53 UTC
Read the original article Hit count: 143

Filed under:
|
|

I'm working on a small sketch in processing where I am making a "clock" using the time functions and drawing ellipses across the canvas based on milliseconds, seconds and minutes. I'm using a for loop to draw all of the ellipses and each for loop is inside its own method. I'm calling each of these methods in the draw function. However for some reason only the first method that is called is being drawn, when ideally I would like to have them all being visibly rendered.

//setup program
void setup() {
  size(800, 600);
  frameRate(30);
  background(#eeeeee);
  smooth();
}

void draw(){
  milliParticles();
  secParticles();  
  minParticles();
}

//time based particles
void milliParticles(){
  for(int i = int(millis()); i >= 0; i++) {
      ellipse(random(800), random(600), 5, 5 );
      fill(255);    
  }
}

void secParticles() {
  for(int i = int(second()); i >= 0; i++) {
      fill(0);    
      ellipse(random(800), random(600), 10, 10 );
      background(#eeeeee);
  }
}

void minParticles(){
  for(int i = int(minute()); i >= 0; i++) {
      fill(50);
      ellipse(random(800), random(600), 20, 20 );
  }
}

© Stack Overflow or respective owner

Related posts about java

Related posts about processing